// App.tsx
// 导入路由
import { BrowserRouter as Router, Route, Redirect } from 'react-router-dom'
import { PrivateRoute } from '@/components/PrivateRoute'
import '@/App.scss'
// 导入页面组件
import Login from './pages/Login/Login'
import Layout from './pages/Layout/Layout'
import ProfileEdit from '@/pages/Profile/Edit'
import Chat from './pages/Profile/Chat/Chat'
import Search from './pages/Search/Search'
import Result from './pages/Search/Result/Result'
import Article from './pages/Article/Article'
// 配置路由规则
function App() {
  return (
    <Router>
      <div className="app">
        <Route path="/home">
          <Layout />
        </Route>
        <Route path="/login">
          <Login />
        </Route>
        <PrivateRoute path="/profile/edit">
          <ProfileEdit />
        </PrivateRoute>
        {/* <Route path="/profile/edit">
          <ProfileEdit />
        </Route> */}
        <PrivateRoute path="/chat">
          <Chat />
        </PrivateRoute>
        <Route exact path="/search">
          <Search></Search>
        </Route>
        <Route path="/search/result">
          <Result></Result>
        </Route>
        <Route exact path="/Article/:id">
          <Article></Article>
        </Route>
        <Route exact path="/" render={() => <Redirect to="/home" />} />
      </div>
    </Router>
  )
}

export default App